import { Inject, Get } from '@midwayjs/decorator';
import { CoolController, BaseController, CoolUrlTag, TagTypes } from '@cool-midway/core';
import { NoticeService } from '../../service/notice';


/**
 * 公告
 */
@CoolUrlTag({ key: TagTypes.IGNORE_TOKEN, value: ['getNotice'] })
@CoolController()
export class NoticeController extends BaseController {
    @Inject()
    noticeService: NoticeService;

    /**
     * 获取公告
     */
    @Get('/getNotice')
    async getNotice() {
        const { success, message, data } = await this.noticeService.getNotice();
        if (!success) return this.fail(data, message);
        return this.ok(data, message);
    }
}
